
swap.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <swap>:
#include <stdio.h>

void swap(int u, int v)
{
   0:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
   4:	910003fd 	mov	x29, sp
   8:	b9001fa0 	str	w0, [x29, #28]
   c:	b9001ba1 	str	w1, [x29, #24]
	int temp;
	
	printf("u = %d v = %d\n", u, v);
  10:	90000000 	adrp	x0, 0 <swap>
  14:	91000000 	add	x0, x0, #0x0
  18:	b9401ba2 	ldr	w2, [x29, #24]
  1c:	b9401fa1 	ldr	w1, [x29, #28]
  20:	94000000 	bl	0 <printf>
	temp = u;
  24:	b9401fa0 	ldr	w0, [x29, #28]
  28:	b9002fa0 	str	w0, [x29, #44]
	u = v;
  2c:	b9401ba0 	ldr	w0, [x29, #24]
  30:	b9001fa0 	str	w0, [x29, #28]
	v = temp;
  34:	b9402fa0 	ldr	w0, [x29, #44]
  38:	b9001ba0 	str	w0, [x29, #24]
	printf("u = %d v = %d\n", u, v);
  3c:	90000000 	adrp	x0, 0 <swap>
  40:	91000000 	add	x0, x0, #0x0
  44:	b9401ba2 	ldr	w2, [x29, #24]
  48:	b9401fa1 	ldr	w1, [x29, #28]
  4c:	94000000 	bl	0 <printf>
}
  50:	d503201f 	nop
  54:	a8c37bfd 	ldp	x29, x30, [sp], #48
  58:	d65f03c0 	ret

000000000000005c <errswap>:

void errswap(int *a, int *b)
{
  5c:	d10083ff 	sub	sp, sp, #0x20
  60:	f90007e0 	str	x0, [sp, #8]
  64:	f90003e1 	str	x1, [sp]
	int *temp;

	temp = NULL;
  68:	f9000fff 	str	xzr, [sp, #24]
	temp = a;
  6c:	f94007e0 	ldr	x0, [sp, #8]
  70:	f9000fe0 	str	x0, [sp, #24]
	a = b;
  74:	f94003e0 	ldr	x0, [sp]
  78:	f90007e0 	str	x0, [sp, #8]
	b = temp;
  7c:	f9400fe0 	ldr	x0, [sp, #24]
  80:	f90003e0 	str	x0, [sp]
}
  84:	d503201f 	nop
  88:	910083ff 	add	sp, sp, #0x20
  8c:	d65f03c0 	ret

0000000000000090 <pswap>:

void pswap(int *u, int *v)
{
  90:	d10083ff 	sub	sp, sp, #0x20
  94:	f90007e0 	str	x0, [sp, #8]
  98:	f90003e1 	str	x1, [sp]
	int temp;
	
	//printf("u = %d v = %d\n", &u, &v);
	temp = *u;
  9c:	f94007e0 	ldr	x0, [sp, #8]
  a0:	b9400000 	ldr	w0, [x0]
  a4:	b9001fe0 	str	w0, [sp, #28]
	*u = *v;
  a8:	f94003e0 	ldr	x0, [sp]
  ac:	b9400001 	ldr	w1, [x0]
  b0:	f94007e0 	ldr	x0, [sp, #8]
  b4:	b9000001 	str	w1, [x0]
	*v = temp;
  b8:	f94003e0 	ldr	x0, [sp]
  bc:	b9401fe1 	ldr	w1, [sp, #28]
  c0:	b9000001 	str	w1, [x0]
	//printf("u = %d v = %d\n", &u, &v);
}
  c4:	d503201f 	nop
  c8:	910083ff 	add	sp, sp, #0x20
  cc:	d65f03c0 	ret

00000000000000d0 <ppswap>:

void ppswap(int **a, int **b)
{
  d0:	d10083ff 	sub	sp, sp, #0x20
  d4:	f90007e0 	str	x0, [sp, #8]
  d8:	f90003e1 	str	x1, [sp]
	int *tmp = NULL;
  dc:	f9000fff 	str	xzr, [sp, #24]

	tmp = *a;
  e0:	f94007e0 	ldr	x0, [sp, #8]
  e4:	f9400000 	ldr	x0, [x0]
  e8:	f9000fe0 	str	x0, [sp, #24]
	*a = *b;
  ec:	f94003e0 	ldr	x0, [sp]
  f0:	f9400001 	ldr	x1, [x0]
  f4:	f94007e0 	ldr	x0, [sp, #8]
  f8:	f9000001 	str	x1, [x0]
	*b = tmp;
  fc:	f94003e0 	ldr	x0, [sp]
 100:	f9400fe1 	ldr	x1, [sp, #24]
 104:	f9000001 	str	x1, [x0]
}
 108:	d503201f 	nop
 10c:	910083ff 	add	sp, sp, #0x20
 110:	d65f03c0 	ret

0000000000000114 <main>:
	  printf("a = %d b = %d\n", (a), (b));	\
	} while (--__size > 0);						      \
    } while (0)

int main()
{
 114:	a9bb7bfd 	stp	x29, x30, [sp, #-80]!
 118:	910003fd 	mov	x29, sp
 11c:	a90153f3 	stp	x19, x20, [sp, #16]
 120:	f90013f5 	str	x21, [sp, #32]
	int a = 3, b = 4;
 124:	52800060 	mov	w0, #0x3                   	// #3
 128:	b9004ba0 	str	w0, [x29, #72]
 12c:	52800080 	mov	w0, #0x4                   	// #4
 130:	b90047a0 	str	w0, [x29, #68]
	int *pa = &a, *pb = &b;
 134:	910123a0 	add	x0, x29, #0x48
 138:	f9001fa0 	str	x0, [x29, #56]
 13c:	910113a0 	add	x0, x29, #0x44
 140:	f9001ba0 	str	x0, [x29, #48]

	swap(a, b);
 144:	b9404ba0 	ldr	w0, [x29, #72]
 148:	b94047a1 	ldr	w1, [x29, #68]
 14c:	94000000 	bl	0 <swap>
	printf("swap : a = %d b = %d\n", a, b);	// 3	4
 150:	b9404ba1 	ldr	w1, [x29, #72]
 154:	b94047a2 	ldr	w2, [x29, #68]
 158:	90000000 	adrp	x0, 0 <swap>
 15c:	91000000 	add	x0, x0, #0x0
 160:	94000000 	bl	0 <printf>

	errswap(&a, &b);
 164:	910113a1 	add	x1, x29, #0x44
 168:	910123a0 	add	x0, x29, #0x48
 16c:	94000000 	bl	5c <errswap>
	printf("errswap : a = %d b = %d\n", a, b);	// 3	4
 170:	b9404ba1 	ldr	w1, [x29, #72]
 174:	b94047a2 	ldr	w2, [x29, #68]
 178:	90000000 	adrp	x0, 0 <swap>
 17c:	91000000 	add	x0, x0, #0x0
 180:	94000000 	bl	0 <printf>
	
	pswap(&a, &b);
 184:	910113a1 	add	x1, x29, #0x44
 188:	910123a0 	add	x0, x29, #0x48
 18c:	94000000 	bl	90 <pswap>
	printf("a = %d b = %d\n", a, b);	// 4	3
 190:	b9404ba1 	ldr	w1, [x29, #72]
 194:	b94047a2 	ldr	w2, [x29, #68]
 198:	90000000 	adrp	x0, 0 <swap>
 19c:	91000000 	add	x0, x0, #0x0
 1a0:	94000000 	bl	0 <printf>

	ppswap(&pa, &pb);
 1a4:	9100c3a1 	add	x1, x29, #0x30
 1a8:	9100e3a0 	add	x0, x29, #0x38
 1ac:	94000000 	bl	d0 <ppswap>
	printf("a = %d b = %d\n", a, b);	// 4	3
 1b0:	b9404ba1 	ldr	w1, [x29, #72]
 1b4:	b94047a2 	ldr	w2, [x29, #68]
 1b8:	90000000 	adrp	x0, 0 <swap>
 1bc:	91000000 	add	x0, x0, #0x0
 1c0:	94000000 	bl	0 <printf>

	SWAP(pa,pb,3);
 1c4:	d2800073 	mov	x19, #0x3                   	// #3
 1c8:	f9401fb5 	ldr	x21, [x29, #56]
 1cc:	f9401bb4 	ldr	x20, [x29, #48]
 1d0:	394002a0 	ldrb	w0, [x21]
 1d4:	39013fa0 	strb	w0, [x29, #79]
 1d8:	f9401fa1 	ldr	x1, [x29, #56]
 1dc:	f9401ba2 	ldr	x2, [x29, #48]
 1e0:	90000000 	adrp	x0, 0 <swap>
 1e4:	91000000 	add	x0, x0, #0x0
 1e8:	94000000 	bl	0 <printf>
 1ec:	aa1503e0 	mov	x0, x21
 1f0:	91000415 	add	x21, x0, #0x1
 1f4:	39400281 	ldrb	w1, [x20]
 1f8:	39000001 	strb	w1, [x0]
 1fc:	aa1403e0 	mov	x0, x20
 200:	91000414 	add	x20, x0, #0x1
 204:	39413fa1 	ldrb	w1, [x29, #79]
 208:	39000001 	strb	w1, [x0]
 20c:	f9401fa1 	ldr	x1, [x29, #56]
 210:	f9401ba2 	ldr	x2, [x29, #48]
 214:	90000000 	adrp	x0, 0 <swap>
 218:	91000000 	add	x0, x0, #0x0
 21c:	94000000 	bl	0 <printf>
 220:	d1000673 	sub	x19, x19, #0x1
 224:	f100027f 	cmp	x19, #0x0
 228:	54fffd41 	b.ne	1d0 <main+0xbc>  // b.any
	
	return 0;
 22c:	52800000 	mov	w0, #0x0                   	// #0
}
 230:	a94153f3 	ldp	x19, x20, [sp, #16]
 234:	f94013f5 	ldr	x21, [sp, #32]
 238:	a8c57bfd 	ldp	x29, x30, [sp], #80
 23c:	d65f03c0 	ret
